<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #box{
            position: relative;
            display: inline-block;
        }
        #box img:nth-child(2){
            position: absolute;
            right: 10px;
            top: 10px;
            cursor: pointer;
        }
    </style>
</head>
<body>
    <div id="box">
        <img src="../img/img_02.jpg" alt="" width="250">
        <img src="../img/close.jpg" alt="" width="40" id= "close">
    </div>

    <script>
        window.onload = function(){
            // 1、获取标签
            let close = document.getElementById('close');
            let box = document.getElementById('box')

            // 2、监听点击
            close.onclick = function(){
                // this.parentNode.remove();
                box.remove();

            }


        }
    </script>
</body>
</html>